package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 攻略分类的数据模型
 */
@Getter
@Setter
@JsonIgnoreProperties("handler")
public class Strategycatalog extends BaseDomain{


    private String name;//攻略分类名称

    private Integer sequence;//序号

    private Boolean state = false;//状态

    //将大攻略的对象拆分开来

    private Long  strategyId;//攻略id

    private String  strategyTitle;//攻略的标题

    //临时增加的攻略分类下的所有攻略文章
    private List<StrategyDetail> strategyDetail ;

    public String getStateName(){
        String msg = "禁用" ;
        if(state){
            msg = "启用" ;
        }
        return msg ;
    }
    //生成存储在编辑按钮的数据
    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        map.put("sequence",sequence);
        map.put("state",state);
        map.put("id",id);
        map.put("strategyId",strategyId);
        return JSONUtil.toJSONString(map);
    }

}